<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>axios手写</title>
</head>
<body>
	<button>get1</button>
	<button>get2</button>
</body>
<script src="./node_modules/axios/dist/axios.js"></script>
<script type="module">
	import axios from "./index.js";
	const btns = document.querySelectorAll("button");
	btns[0].onclick = function(){
		// 通过axios发送请求
		// 1- 第一个参数是请求地址，2- 第二个参数是配置信息
		const result = axios("/info",{
			method:"post",
			params:{
				a:1,
				b:2
			}
		});
		console.log(result);// pending undefined
	}
	btns[1].onclick = function(){
		// 第一个参数即是配置信息
		axios({
			url:"/info",
			params:{
				a:11,
				b:21
			}
		});
	}
	
</script>
</html>